package com.vividstores.integration.mq;

import java.util.Properties;

import org.apache.commons.beanutils.BeanUtils;

import com.vividstores.integration.mq.impl.MQFileReceiverImpl;

public class ReceiveFileLauncher {

	public static void main(String[] args) {
		try {
			Properties properties = new Properties();
			properties.load(ClassLoader.getSystemResourceAsStream("mq.receive.properties"));
			
			MQFileReceiverImpl fileReceiver = new MQFileReceiverImpl();
			BeanUtils.populate(fileReceiver, properties); //设置MQFileReceiver的Queue连接信息

			// 等待MQ中的文件传输请求到达，若Queue中无文件传输请求，则线程一直挂起
			MQFileBundle fileBundle = fileReceiver.receive(new MQSimpleFileReceiverHandler("D:\\tmp"));
			System.out.println(fileBundle);
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
